home *** CD-ROM | disk | FTP | other *** search
/ HPAVC / HPAVC CD-ROM.iso / pc / BKISSSRC.ZIP / LOADER / PALETTE.INC < prev    next >
Encoding:
Text File  |  1993-12-12  |  2.7 KB  |  63 lines

  1. ;fade_out
  2.  
  3. PALETTE_NUMBER = 256       ;normally 256
  4. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  5. macro       Decrease source
  6.             local @@Done
  7.             cmp source,0
  8.             jz @@Done
  9.             dec source
  10. @@Done:     exitm
  11. endm        Decrease
  12. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  13. macro       WaitForRetrace
  14.             local @@WaitHi, @@WaitLo
  15.             mov dx,3DAh
  16. @@WaitHi:   in al,dx
  17.             test al,8
  18.             jnz @@WaitHi
  19. @@WaitLo:   in al,dx
  20.             test al,8
  21.             jz @@WaitLo
  22. endm        WaitForRetrace
  23. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░
  24. PROC        fade_out
  25.             mov cx,64
  26. @@NextLoop: push cx
  27.             WaitForRetrace                ;wait for a vertical retrace
  28.             mov cx,PALETTE_NUMBER
  29. @@NextColor:      mov dx,3C7h                   ;\
  30.                   mov al,cl                     ; \ send out the color number
  31.                   dec al                        ; /
  32.                   out dx,al                     ;/
  33.                   mov dx,3C9h                   ;DX = DAC_DATA
  34.                   in al,dx                      ;\
  35.                   Decrease al                   ; > BL = red
  36.                   mov bl,al                     ;/
  37.                   in al,dx                      ;\
  38.                   Decrease al                   ; > BH = green
  39.                   mov bh,al                     ;/
  40.                   in al,dx                      ;\
  41.                   Decrease al                   ; > AH = blue
  42.                   mov ah,al                     ;/
  43.                   mov dx,3C8h                   ;\
  44.                   mov al,cl                     ; \ send out the color number
  45.                   dec al                        ; /
  46.                   out dx,al                     ;/
  47.                   mov dx,3C9h                   ;DX = DAC_DATA
  48.                   mov al,bl                     ;\ send out new red
  49.                   out dx,al                     ;/
  50.                   mov al,bh                     ;\ send out new green
  51.                   out dx,al                     ;/
  52.                   mov al,ah                     ;\ send out new blue
  53.                   out dx,al                     ;/
  54.  
  55.                   dec cx                        ;\ loop until all colors
  56.                   jnz @@NextColor               ;/ are done
  57.             pop cx
  58.             dec cx                        ;\ loop until all cycles are done
  59.             jnz @@NextLoop                ;/
  60.             ret                           ;return
  61. ENDP        fade_out
  62. ;░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░░ 
  63.